package com.blb.day3;

public class BaoziTest2 {

    public static void main(String[] args) {
        BaoziShop2 shop = new BaoziShop2();
        //模拟生产者
        Thread thread = new Thread(() -> {
            for (int i = 0; i < 200; i++) {
                shop.makeBaozi();
            }
        });
        thread.setPriority(Thread.MAX_PRIORITY);
        thread.start();
        //模拟消费者
        for(int i = 0;i < 10;i++){
            new Thread(() -> {
                for(int j = 0;j < 20;j++){
                    shop.sellBaozi();
                }
            }).start();
        }
    }
}
